/*
 This file 'zdwxy_1' is part of Firebird Integrated Solution 1.0

 Copyright (c) 2020 Lincong

 Contact:  
        Email: lincong1987@gmail.com

        QQ: 159257119
 
 See Usage at http://www.jplatformx.com/firebird

 Create date: 2020-06-14 20:49
 */

define(function (require, exports, module) {

	require("../model/Chart");

	var ArrayUtils = require("../assets/ArrayUtils");

	var id = "zdwxy_3";

	Firebird.define(id, {
		extend: "Chart",
		setValue: function (data) {

			this.data = data = [
				{
					total: 100,
					value: 45,
					name: "炼化",
				}, {
					total: 100,
					value: 12,
					name: "勘探"
				}, {
					total: 100,
					value: 12,
					name: "销售"
				}, {
					total: 100,
					value: 12,
					name: "天然气销售"
				}, {
					total: 100,
					value: 12,
					name: "工技"
				}
			]

			var option = {
				tooltip: {
					trigger: 'item',
				},

				grid: {
					top: 30,
					left: 65,
					right: 65,
					bottom: 50
				},

				legend: {
					top: 0,
					textStyle: {
						color: '#fff',
					},
				},
				xAxis: [
					{
						type: 'category',
						axisLine: {
							lineStyle: {
								color: 'rgba(2, 234, 252, 1)'
							}
						},
						axisLabel: {
							fontSize: 16,
							color: '#fff'
						},
						data: data.map(function (node) {
							return node.name;
						}),
					}
				],
				yAxis: [
					{
						type: 'value',
						min: 0,
						splitLine: {
							lineStyle: {
								color: 'rgba(2, 234, 252, 1)'
							}
						},
						splitNumber: 5,
						axisLine: {
							show: true  ,
							lineStyle: {
								color: 'rgba(2, 234, 252, 1)'
							}
						},
						axisTick: {
							show: false
						},
						axisLabel: {
							fontSize: 16,
							color: '#fff'
						},

					}
				],
				series: [
					{
						name: '总数',
						type: 'bar',
						barWidth: 24,
						data: data.map(function (node) {
							return node.total;
						}),
						itemStyle: {
							normal: {
								color: Chart.linearGradient("rgba(97, 81, 240, 1)", "rgba(65, 121, 251, 1)")
							},
						}
					}, {
						name: '接入数',
						type: 'bar',
						barGap: 0,
						barWidth: 24,
						data: data.map(function (node) {
							return node.value;
						}),
						itemStyle: {
							normal: {
								color: Chart.linearGradient("rgba(201, 144, 74, 1)", "rgba(226, 195, 146, 1)")
							}
						}
					}
				]
			};

			this.clear();
			this.setOption(option, !0);
		},
	});

	module.exports = Firebird.create(id, {id: id});
});